package com.dream.vo.api;

import java.io.Serializable;

public class SpinnerItem implements Serializable,Comparable<SpinnerItem> {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1181434529766636734L;

	private String code;
	
	private String name;
	
	public SpinnerItem(){}
	
	public SpinnerItem(String code,String name){
		this.code = code;
		this.name = name;
	}
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((code == null) ? 0 : code.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SpinnerItem other = (SpinnerItem) obj;
		if (code == null) {
			if (other.code != null)
				return false;
		} else if (!code.equals(other.code))
			return false;
		return true;
	}

	@Override
	public int compareTo(SpinnerItem other) {
		return this.name.compareTo(other.name);
	}

	@Override
	public String toString() {
		return name;
	}
}
